import ca from "element-ui/src/locale/lang/ca";

export const tableOption = {
  "border": true,
  "stripe": true,
  "menuAlign": "center",
  "align": "center",
  "searchMenuSpan": 6,
  "column": [
    {
      "type": "input",
      "label": "品牌id",
      "prop": "brandId",
      "editDisabled": true,
      "addDisplay": false,
      "width": 120
    }, {
      "type": "input",
      "label": "品牌名",
      "prop": "name",
      "rules": [
        {
        "required": true,
        "message": "品牌名不能为空",
        "trigger": "blur"
        }
      ]
    }, {
      "type": "upload",
      "listType": "picture-img",
      "label": "品牌logo",
      "prop": "logo",
      "oss": "ali",
      "loadText": "附件上传中，请稍等",
      "tip": "只能上传jpg/png文件，且不超过500kb"
    }, {
      "type": "input",
      "label": "介绍",
      "prop": "descript"
    }, {
      "type": "switch",
      "label": "是否显示",
      "prop": "showStatus",
      "value": 1,
      "dicData": [{value: 0}, {value: 1}],
      "slot": true
    }, {
      "type": "input",
      "label": "检索首字母",
      "prop": "firstLetter",
      "rules": [
        {
          "validator": (rule, value, callback)=>{
            if (value === ''){
              callback(new Error('首字母必须填写'))
            } else if (!/^[a-zA-Z]$/.test(value)) {
              callback(new Error('首字母必须a-z或者A-Z之间'));
            } else {
              callback();
            }
          },
          "trigger": "blur"
        }
      ]
    }, {
      "type": "input",
      "label": "排序",
      "prop": "sort",
      "value": 0,
      "rules": [
        {
          "validator": (rule, value, callback)=>{
            if (value === ''){
              callback(new Error('排序字段必须填写'))
            }  else {
              callback();
            }
          },
          "trigger": "blur"
        }
      ]
    }
  ]
}
